package com.njcb.ams.service;

import java.util.ArrayList;
import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.njcb.ams.orm.dao.AppInfoDAO;
import com.njcb.ams.orm.entity.AppInfo;
import com.njcb.ams.orm.entity.AppInfoExample;
import com.njcb.ams.pojo.dto.AppInfoQueryRequest;
import com.njcb.ams.pojo.dto.AppInfoQueryResponse;
import com.njcb.ams.util.AmsBeanUtils;

@Service
public class AppInfoService {
	private static final Logger logger = LoggerFactory.getLogger(AppInfoService.class);
	@Autowired
	private AppInfoDAO appInfoDAO;

	/**
	 * 方法功能描述：应用系统信息查询
	 * @param request
	 * @return
	 */
	public List<AppInfoQueryResponse> appInfoQuery(AppInfoQueryRequest request){
		//查询数据库
		List<AppInfo> list = appInfoDAO.selectByExample(new AppInfoExample());
		logger.info("查询得到数据条数{}",list.size());
		List<AppInfoQueryResponse> rtlist = new ArrayList<AppInfoQueryResponse>();
		//将实体对象AppInfo转为视图对象AppInfoQueryResponse
		for (AppInfo appInfo : list) {
			AppInfoQueryResponse app = new AppInfoQueryResponse();
			AmsBeanUtils.copyProperties(app, appInfo);
			rtlist.add(app);
		}
		return rtlist;
	}
	
}
